 $(document).ready(function(){   
   var doc=document,
    inputs=doc.getElementsByTagName('input'),
    supportPlaceholder='placeholder'in doc.createElement('input'),
    
    placeholder=function(input){
     var text=input.getAttribute('placeholder'),
     defaultValue=input.defaultValue;
     if(defaultValue==''){
		input.style.color="#999";
        input.value=text;
     }
     input.onfocus=function(){
        if(input.value===text)
        {
			this.style.color="#000";
            this.value='';
        }
      };
     input.onblur=function(){
        if(input.value===''){
			this.style.color="#999";
            this.value=text;
        }
      }
  };
  
  if(!supportPlaceholder){
     for(var i=0,len=inputs.length;i<len;i++){
          var input=inputs[i],
          text=input.getAttribute('placeholder');
          if(input.type==='text'&&text){
             placeholder(input);
          }
      }
  }
 });